//index.js
// 获取应用实例
const app = getApp();

Page({
  data: {
    username: '',
    password: '',
    clientHeight: '',
  },

  onLoad() {
    var that = this;
    wx.getSystemInfo({
      success: function (res) {
        console.log(res.windowHeight);
        that.setData({
          clientHeight: res.windowHeight
        });
      }
    });
  },

  // 协议
  goxieyi() {
    wx.navigateTo({
      url: '/pages/oppoint/oppoint',
    });
  },

  // 获取输入内容
  phone(e) {
    this.setData({ username: e.detail.value });
  },

  password(e) {
    this.setData({ password: e.detail.value });
  },

  // 登录事件
  goadmin() {
    const { username, password } = this.data;
    console.log(this.data.username)
    if (username.trim() === '') {
      wx.showToast({
        icon: 'none',
        title: '账号不能为空',
      });
    } else if (password.trim() === '') {
      wx.showToast({
        icon: 'none',
        title: '密码不能为空',
      });
    } else {
      wx.navigateTo({
        url: '/pages/login/login',
      });
    }
  },
});
